#pragma once
#ifndef SQUAD_H
#define SQUAD_H

#include <vector>
#include <list>
#include "MiscFunctions.h"
#include "vertex.h"
#include "triangleAgent.h"
#include "circleAgent.h"
#include "rectangleAgent.h"
#include "agent.h"
#include "mapNode.h"
#include "Terrain.h"

#define GOALSHIFTTIME 5000

using namespace std;

/*
// Used in A* planning in conjunction with terrain map
struct mapPoint{
	int x, y;
};
*/

#ifndef TEAM_T
#define TEAM_T
enum team_T {RED, BLUE};
#endif//TEAM_T

#define SQ_TRI_COST 100
#define SQ_CIR_COST 200
#define SQ_REC_COST 300

class squad
{
public:
	squad(void);
	squad(team_T, shape_T, vertex);              // New squad instances should only depend on agent type (plus starting position)
	~squad(void);

	team_T team;                 // Team that the squad belongs to
	shape_T type;                // Type of agents in squad
	int maxAgents;               // Maximum possible agents
	int unitPopCost;                // The population cost of each individual unit
	vector<agent*> agentList;    // Determine squad size based on unit selected?
	//vertex goal;                 // Goal location pertaining to entire squad
	list<vertex> goalList;      // List of goal nodes (empty means no goal is active
	bool selected;              // If the squad is selected by the user
	bool attacking;             // If at least one squad agent is actively attacking another object
	bool aggressive;            // If behavior mode of squad is aggressive (attack on site)
	int expInterval;            // Explore mode variable: time required before goal is shifted
	int expTimer;               // Explore mode variable: timer for goal shifts

	// Boids modifiers pertaining to squad
	float sepRange, sepModifier;       // Seperation
	float avoidRange, avoidModifier;   // Seperation from agents of other squads
	float cohRange, cohModifier;       // Cohesion
	float aliRange, aliModifier;       // Alignment
	float borRange, borModifier;       // World Border
	float obsRange, obsModifier;       // Obstacles
	float goalRange, goalModifier;     // Goal
	float attackRange;                 // Range in which an agent may open attack on opposing object

	// A* relevant functions
	mapNode mapPosition(Terrain *);  // Fetches map node of squad center
//	mapNode goalPosition(Terrain *);  // Fetches map node of goal (NOT USED CURRENTLY)

	// User interface functions
	bool isBoxSelected(float, float, float, float);
	
	//Goal checks
	bool updateGoal(Terrain *);

	//Explore mode functions
	bool isExploring(void);
	void activateExplore(Terrain*);
	void deactivateExplore(void);
	vertex randomMapPoint(Terrain*);

private:
	bool exploring;             // If behavior mode of squad is explorative (assigns its own waypoint goals)

};
#endif
